#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 直接将文件压缩后推送到远程服务器中
import os
import sys
import tarfile


def create_tar(tar_file, src_file):
    with tarfile.open(tar_file, "w:gz") as tar:
        tar.add(src_file, arcname=os.path.basename(src_file))
    tar.close()


def create_tar_only_file(tar_file, src_file):
    tar = tarfile.open(tar_file, "w:gz")
    for root, dir, files in os.walk(src_file):
        for file in files:
            path_file = os.path.join(root, file)
            tar.add(path_file)
    tar.close()


class PushFile:
    pass
